import { MockMethod } from 'vite-plugin-mock';
import { resultPageSuccess, resultSuccess } from '../_util';

const demoList = (() => {
  const result: any[] = [];
  for (let index = 0; index < 60; index++) {
    result.push({
      id: `${index}`,
      createTime: '@datetime',
      endTime: '@datetime',
      address: '@city()',
      positionName: '@integer(1, 8)' + '楼',
      imgUrl: '@image()',
      // 'position_type|1': ['仓库', '办公室'],
      'no|100000-10000000': 100000,
      'status|1': ['正常', '启用', '停用'],
      children: [
        {
          id: `${index}`,
          createTime: '@datetime',
          endTime: '@datetime',
          address: '@city()',
          positionName: '@integer(1, 8)' + '室',
          imgUrl: '@image()',
          'positionType|1': ['仓库', '办公室'],
          'no|100000-10000000': 100000,
          'status|1': ['正常', '启用', '停用'],
        },
      ],
    });
  }
  return result;
})();
enum Api {
  list = '/assetposition/assetPosition/rootList',
  save = '/assetposition/assetPosition/add',
  edit = '/assetposition/assetPosition/edit',
  deleteAssetPosition = '/assetposition/assetPosition/delete',
  importExcel = '/assetposition/assetPosition/importExcel',
  exportXls = '/assetposition/assetPosition/exportXls',
  loadTreeData = '/assetposition/assetPosition/loadTreeRoot',
  getChildList = '/assetposition/assetPosition/childList',
  getChildListBatch = '/assetposition/assetPosition/getChildListBatch',
}
const prefix = '/jeecgboot';
export default [
  // {
  //     url: prefix + Api.list,
  //     timeout: 1000,
  //     method: 'get',
  //     response: ({ query }) => {
  //         const { page = 1, pageSize = 20 } = query;
  //         return resultPageSuccess(page, pageSize, demoList);
  //     }
  // },
  // {
  //     url: prefix + Api.loadTreeData,
  //     timeout: 1000,
  //     method: 'get',
  //     response: ({ query }) => {
  //       const { page = 1, pageSize = 20 } = query;
  //       return resultPageSuccess(page, pageSize, demoList);
  //   }
  //   },
  // //定义删除接口
  // {
  //     url: prefix + Api.deleteAssetPosition,
  //     timeout: 1000,
  //     method: 'post',
  //     response: () => {
  //         return resultSuccess('ok');
  //       },
  // },
  // //定义添加接口
  // {
  //     url: prefix + Api.save,
  //     timeout: 1000,
  //     method: 'post',
  //     response: () => {
  //         return resultSuccess('ok');
  //       },
  // },
  //   //定义编辑接口
  // {
  //   url: prefix + Api.edit,
  //   timeout: 1000,
  //   method: 'post',
  //   response: () => {
  //     return resultSuccess('ok');
  //   },
  // },
] as MockMethod[];
